import React from 'react';
import { Form, Row, DatePicker, Button, Select, Input, Col } from 'antd';
const FormItem = Form.Item;
const { RangePicker } = DatePicker;
const { Option } = Select;

const SearchForm = ({ form: { getFieldDecorator, getFieldsValue, resetFields }, onSearch, onClick, advanced }) => {
  const onHandleAdvanced = () => {
    if (onClick) {
      onClick();
    }
  };

  const formItemLayout = {
    // 抽屉里面Form。二列的布局比例
    labelCol: {
      span: 6
    },
    wrapperCol: {
      span: 16
    }
  };
  return (
    <Form className="search-form">
      <Row gutter={24}>
        <Col span={5}>
          <FormItem label="文件名称"{...formItemLayout}>
            {getFieldDecorator('agreementName')(
              <Input placeholder='请输入文件名称' allowClear />
            )}
          </FormItem>
        </Col>

        <Col span={5}>
          <FormItem label="修改时间"{...formItemLayout}>
            {getFieldDecorator('updateTime')(
              <RangePicker placeholder={['开始时间', '结束时间']} 
              // showTime={{
           
              //   defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('11:59:59', 'HH:mm:ss')],
              // }}
                format="YYYY-MM-DD HH:mm:ss" style={{ width: '100%' }} />
            )}
          </FormItem>
        </Col>
        <Col span={5}>
          <FormItem label="最后修改人"{...formItemLayout}>
            {getFieldDecorator('updaterName')(
              <Input placeholder='请输入修改人' allowClear />
            )}
          </FormItem>
        </Col>
        <Col span={4} style={{ display: 'flex' }} className="serarch-btns">
          <FormItem>
            <Button icon="search" type="primary" onClick={() => onSearch(getFieldsValue())}>
              {'查询'}
            </Button>
          </FormItem>
          <FormItem>

            {/* <Button type="primary" icon={advanced ? 'up' : 'down'} onClick={() => onHandleAdvanced()}>
              {'展开'}
            </Button> */}
          </FormItem>
          <FormItem>

            <Button type="default" icon={'redo'} onClick={() => resetFields()}>
              {'重置'}
            </Button>
          </FormItem>
        </Col>
      </Row>

    </Form>
  );
};

export default Form.create()(SearchForm);
